﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;

namespace AppAcc.Views.BaoCao
{
    public partial class FormBaoCaoNhatKyChiTienMat : Form
    {
        public FormBaoCaoNhatKyChiTienMat()
        {
            InitializeComponent();
        }
        string tk, tkdu;
        DateTime d1, d2;
        public FormBaoCaoNhatKyChiTienMat(string tk1, string tkdu1, DateTime dt1, DateTime dt2)
        {
            InitializeComponent();
            tk = tk1.Trim();
            tkdu = tkdu1.Trim();
            d1 = dt1;
            d2 = dt2;
        }
        private void FormBaoCaoNhatKyChiTienMat_Load(object sender, EventArgs e)
        {
            try
            {
                // this.pr_SoThuChiTableAdapter.Fill(this.dS_SoQuyTienMat.pr_SoThuChi, SoTK, dt1, dt2);
                // this.pr_SoQuyTienMatTableAdapter.Fill(this.dataSet_SoQuyTienMat.pr_SoQuyTienMat, SoTK, dt1, dt2);
                this.pr_NhatKyChiTienMatTableAdapter.Fill(this.dataSet_NhatKyChiTienMat.pr_NhatKyChiTienMat, tk, tkdu, d1, d2);
                ReportParameter[] rptParams = new ReportParameter[]
            {
                new ReportParameter("SoTK",tk), 
                new ReportParameter("TKDU",tkdu),
                new ReportParameter("TuNgay",Convert.ToString(d1)),
                new ReportParameter("DenNgay",Convert.ToString(d2)),
            };
                reportViewer1.LocalReport.SetParameters(rptParams);
                this.reportViewer1.RefreshReport();
            }
            catch (Exception)
            {
                this.pr_NhatKyChiTienMatTableAdapter.Fill(this.dataSet_NhatKyChiTienMat.pr_NhatKyChiTienMat, tk, tkdu, d1, d2);
                ReportParameter[] rptParams = new ReportParameter[]
            {
                new ReportParameter("SoTK",tk), 
                new ReportParameter("TKDU",tkdu),
                new ReportParameter("TuNgay",Convert.ToString(d1)),
                new ReportParameter("DenNgay",Convert.ToString(d2)),
            };
                reportViewer1.LocalReport.SetParameters(rptParams);
                this.reportViewer1.RefreshReport();
                //  throw;
            }
        }
    }
}
